import instance from "./request";
import qs from 'qs'
//这个文件用来统一管理所有的API接口

//首页精品推荐请求
export const jingpinAPI = () => instance.get('/products/recommend')

//首页热门兑换请求
export const HotPinAPI = () => instance.get('/products/hot')

//短信验证码请求
export const SendSMSAPI = (params) => instance.post('/sendSMS', qs.stringify(params))

//手机号验证码登录(含注册)
export const PhoneLoginAPI = (params) => instance.post('/phoneRegin', qs.stringify(params))

//微信扫码登录
export const WeiXinLoginAPI = (params) => instance.post('/wechatUsers/PCLogin', qs.stringify(params))

//手机号绑定微信登录
export const PhonBindWxAPI = (params) => instance.post('/wechatUsers/binding', qs.stringify(params))

//获取用户信息
export const userProfilesAPI = () => instance.get('/shop/userProfiles')

//商品详情页请求 get路径带参数
export const GoodsDetailsAPI = (id) => instance.get(`/products/${id}`)

//加入购物车请求
export const AddToCartAPI = (params) => instance.post('/shop/carts/add', qs.stringify(params))

//商品搜索（含首页的“更多”） get带请求体
export const SearchGoodsAPI = (params) => instance.get('/products', { params })